from ActionConnect import ActionConnect
from ActionChangeUsername import ActionChangeUsername
from ActionGetEvents import ActionGetEvents
from ActionJoin import ActionJoin
from ActionPart import ActionPart
from ActionPrivateTalk import ActionPrivateTalk
from ActionReconnect import ActionReconnect
from ActionSelfTalk import ActionSelfTalk
from ActionTalk import ActionTalk

class ActionFactory:
    _actions = [ActionConnect(), ActionChangeUsername(), ActionGetEvents(), ActionJoin(), ActionPart(), ActionPrivateTalk(), ActionReconnect(), ActionSelfTalk(), ActionTalk()]

    @classmethod    
    def get_instance(cls, action):
        if action is None:
            return None
        
        for f_action in cls._actions:
            if f_action.is_action(action):
                return f_action

        return None
